<div style="min-height: 300px;" class="portlet x12">
	<div class="portlet-header"><h4><?php if (isset($mode) && $mode =='add') { ?>Thêm mới <?php } else { ?> Sửa <?php } ?>danh mục</h4></div>
		<div class="portlet-content" >
			<form class="form label-inline" style="width: 100%;" id="form_edit_add" method="post" action="<?php echo base_url();?>admin/categories/<?php echo $action; ?>" enctype="multipart/form-data">
				<div style="width : 50%; float:left;">
					<div class="field">
						<label for="fname" >Tên danh mục</label>
						<input type="text" class="medium" size="50" name="name" id="name" value="<?php echo (isset($detail->name))?$detail->name:"";?>">
					</div>

					<!--<div style="width : 50%; float:left;">-->
						<div class="field">
							<label for="fname" >Tên tiếng anh</label>
							<input type="text" class="medium" size="50" name="name_en" id="name_en" value="<?php echo (isset($detail->name_en))?$detail->name_en:"";?>">
					</div>
					<div class="field">
						<label for="image">Hình ảnh <?php if (isset($mode) && $mode =='add') {} else { ?> khác <?php } ?></label>
						<input type="file" name="img" />
					</div>
				</div>

				<!-- echo anh ra -->
				<div style=""><?php if(isset($detail->file_name)){ ?><img src="<?php echo base_url (); ?>application/storage/images/<?php echo $detail->file_name; ?>" alt="picture" width="286" height="102" /><?php } ?></div>
				<!-- ket thu echo anh-->

				<div class="field">
					<label for="description">Mô tả Tiếng Việt</label>
				</div>

				 <div class="field">
					<?php

					$config_mini = array();

					$config_mini['toolbar'] = array(
					array( 'Source', '-', 'Bold', 'Italic', 'Underline', 'Strike' ,'-', 'Link', 'Unlink', 'Anchor','Image')
					);
					$config_mini['filebrowserBrowseUrl'] = base_url()."ckeditor/kcfinder/browse.php";
					$config_mini['filebrowserImageBrowseUrl'] = base_url()."ckeditor/kcfinder/browse.php?type=images";
					$config_mini['filebrowserUploadUrl'] = base_url()."ckeditor/kcfinder/upload.php?type=files";
					$config_mini['filebrowserImageUploadUrl'] = base_url()."ckeditor/kcfinder/upload.php?type=images";

					echo $this->ckeditor->editor("description", (isset($detail->description))?$detail->description:"");

					?>
				</div>
				<div class="field">
					<label for="description">Mô tả Tiếng Anh</label>
				</div>

				 <div class="field">
					<?php

					$config_mini = array();

					$config_mini['toolbar'] = array(
					array( 'Source', '-', 'Bold', 'Italic', 'Underline', 'Strike' ,'-', 'Link', 'Unlink', 'Anchor','Image')
					);
					$config_mini['filebrowserBrowseUrl'] = base_url()."ckeditor/kcfinder/browse.php";
					$config_mini['filebrowserImageBrowseUrl'] = base_url()."ckeditor/kcfinder/browse.php?type=images";
					$config_mini['filebrowserUploadUrl'] = base_url()."ckeditor/kcfinder/upload.php?type=files";
					$config_mini['filebrowserImageUploadUrl'] = base_url()."ckeditor/kcfinder/upload.php?type=images";

					echo $this->ckeditor->editor("description_en", (isset($detail->description_en))?$detail->description_en:"");

					?>
				</div>

				<br>
				<input type="hidden" name="id" id="id" value="<?php echo (isset($detail->id))?$detail->id:"";?>">
				<div class="buttonrow" align="center" style="margin-left:150px;">
					<input type="button" class="btn btn-orange" id="Save" value="Save">
					<input type="button" class="btn btn-grey" id="Cancel" value="Cancel">
				</div>
		</form>

		<br><br>
	</div>
</div>
<script>
$(document).ready(function(){
	$('.btn-grey').live('click',function(){
		parent.history.back();
		return false;
	})
	$('.btn').click(function(){
		var button_type 	= $(this).attr('value');
		$('#form_edit_add').submit();
	});
});

function check_form(type){
	if(type=='prod'){
		var catid=document.getElementById('catid').value;
		if(catid==0){
			alert('Vui long chon mot danh muc');
			return false;
		}else{
			return true;
		}
	}else{
		return true;
	}
}
</script>